package com.blog.blog.service;

import com.blog.blog.vo.PermissionVO;
import com.blog.blog.vo.RoleVO;

import java.util.List;

public interface SystemService {
    List<RoleVO> listRoles(String keyword);
    List<PermissionVO> listPermissions(String keyword);

    Long createRole(com.blog.blog.dto.SaveRoleDTO dto);
    boolean updateRole(Long id, com.blog.blog.dto.SaveRoleDTO dto);
    boolean deleteRole(Long id);

    Long createPermission(com.blog.blog.dto.SavePermissionDTO dto);
    boolean updatePermission(Long id, com.blog.blog.dto.SavePermissionDTO dto);
    boolean deletePermission(Long id);

    boolean setRolePerms(Long roleId, java.util.List<Long> permIds);
    java.util.List<Long> getRolePermIds(Long roleId);

    java.util.List<Long> getUserRoleIds(Long userId);
    boolean setUserRoles(Long userId, java.util.List<Long> roleIds);

    com.blog.blog.common.PageResponse<com.blog.blog.po.UserPO> pageUsers(String q, Integer pageNo, Integer pageSize);

    /**
     * 判断用户的数据范围是否为 SELF（无任一角色具备 ALL）
     */
    boolean isSelfDataScope(Long userId);

    com.blog.blog.common.PageResponse<com.blog.blog.vo.OperationLogVO> pageOperationLogs(String q, Integer status, Integer pageNo, Integer pageSize);

    // 系统配置
    java.util.List<com.blog.blog.vo.SystemConfigVO> listConfigs(String prefix);
    boolean upsertConfig(String key, String value, String description);

    // 缓存管理（Redis）
    java.util.List<String> scanRedisKeys(String pattern, Integer limit);
    long deleteRedisKeysByPattern(String pattern);
    boolean redisPing();

    // 在线会话
    java.util.List<com.blog.blog.vo.OnlineSessionVO> listOnlineSessions(String q);
    boolean kickoutToken(String token);
}


